﻿using System;

namespace Communication.Message.Buffer
{
	// Token: 0x0200002A RID: 42
	internal class BigEndianHeapMessageBuffer : HeapMessageBuffer
	{
		// Token: 0x0600014F RID: 335 RVA: 0x00003E33 File Offset: 0x00002033
		public BigEndianHeapMessageBuffer(int length) : base(length)
		{
		}

		// Token: 0x06000150 RID: 336 RVA: 0x00003E3C File Offset: 0x0000203C
		public BigEndianHeapMessageBuffer(byte[] array) : base(array)
		{
		}

		// Token: 0x06000151 RID: 337 RVA: 0x00003E45 File Offset: 0x00002045
		private BigEndianHeapMessageBuffer(byte[] array, int readerIndex, int writerIndex) : base(array, readerIndex, writerIndex)
		{
		}

		// Token: 0x06000152 RID: 338 RVA: 0x00003E50 File Offset: 0x00002050
		public override ByteOrder Order()
		{
			return ByteOrder.BIG_ENDIAN;
		}

		// Token: 0x06000153 RID: 339 RVA: 0x00003E53 File Offset: 0x00002053
		public override short GetShort(int index)
		{
			return (short)((int)this.array[index] << 8 | (int)(this.array[index + 1] & byte.MaxValue));
		}

		// Token: 0x06000154 RID: 340 RVA: 0x00003E74 File Offset: 0x00002074
		public override int GetInt(int index)
		{
			return (int)(this.array[index] & byte.MaxValue) << 24 | (int)(this.array[index + 1] & byte.MaxValue) << 16 | (int)(this.array[index + 2] & byte.MaxValue) << 8 | (int)(this.array[index + 3] & byte.MaxValue);
		}

		// Token: 0x06000155 RID: 341 RVA: 0x00003ECA File Offset: 0x000020CA
		public override void SetShort(int index, short s)
		{
			this.array[index] = (byte)(s >> 8);
			this.array[index + 1] = (byte)(s & 255);
		}

		// Token: 0x06000156 RID: 342 RVA: 0x00003EEA File Offset: 0x000020EA
		public override void SetInt(int index, int i)
		{
			this.array[index] = (byte)(i >> 24);
			
			this.array[index + 1] = (byte)(i >> 16);
			this.array[index + 2] = (byte)(i >> 8);
			this.array[index + 3] = (byte)i;
		}

		// Token: 0x06000157 RID: 343 RVA: 0x00003F22 File Offset: 0x00002122
		public override MessageBufferFactory Factory()
		{
			return HeapMessageBufferFactory.GetInstance(ByteOrder.BIG_ENDIAN);
		}
	}
}
